#include "process.h"

void Press(double size, double cur)
{
	const char* str = "|/-\\";
	int m = strlen(str);
	static int index = 0;
	char arr[101];
	memset(arr, '\0', sizeof(arr));
	double du = cur*100/size;		//cur * 100 / total;  
	int sum = (int)du;
	if (sum < 100)
		sum++;
	for (int i = 0; i < sum; i++)
		arr[i] = '#';
	printf("[%-100s][%.1lf%%][%c]\r", arr, du,str[index++]);
	index %= m;
	fflush(stdout);
	if ((cur-size)>=0)
		printf("\n");
}
